
-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server Compact Edition
-- --------------------------------------------------
-- Date Created: 04/30/2014 13:11:34
-- Generated from EDMX file: D:\Projects\Libraries\AppToolkit\Testing\UnitTestUtilsTests\DB\EF\Models\TestModel.edmx
-- --------------------------------------------------


-- --------------------------------------------------
-- Dropping existing FOREIGN KEY constraints
-- NOTE: if the constraint does not exist, an ignorable error will be reported.
-- --------------------------------------------------


-- --------------------------------------------------
-- Dropping existing tables
-- NOTE: if the table does not exist, an ignorable error will be reported.
-- --------------------------------------------------


-- --------------------------------------------------
-- Creating all tables
-- --------------------------------------------------

-- Creating table 'Entity1Set'
CREATE TABLE [Entity1Set] (
    [Id] int IDENTITY(1,1) NOT NULL
);
GO

-- Creating table 'Entity2Set'
CREATE TABLE [Entity2Set] (
    [Id] int IDENTITY(1,1) NOT NULL,
    [Entity1_Id] int  NOT NULL
);
GO

-- --------------------------------------------------
-- Creating all PRIMARY KEY constraints
-- --------------------------------------------------

-- Creating primary key on [Id] in table 'Entity1Set'
ALTER TABLE [Entity1Set]
ADD CONSTRAINT [PK_Entity1Set]
    PRIMARY KEY ([Id] );
GO

-- Creating primary key on [Id] in table 'Entity2Set'
ALTER TABLE [Entity2Set]
ADD CONSTRAINT [PK_Entity2Set]
    PRIMARY KEY ([Id] );
GO

-- --------------------------------------------------
-- Creating all FOREIGN KEY constraints
-- --------------------------------------------------

-- Creating foreign key on [Entity1_Id] in table 'Entity2Set'
ALTER TABLE [Entity2Set]
ADD CONSTRAINT [FK_Entity1Entity2]
    FOREIGN KEY ([Entity1_Id])
    REFERENCES [Entity1Set]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_Entity1Entity2'
CREATE INDEX [IX_FK_Entity1Entity2]
ON [Entity2Set]
    ([Entity1_Id]);
GO

-- --------------------------------------------------
-- Script has ended
-- --------------------------------------------------